//
//  TjVC+UI.swift
//  Auscultation
//
//  Created by 来 on 2020/12/9.
//

import Foundation

extension TjVC {
    
    func initUI() {
        
        let top_view1 = UIImageView.init(image: #imageLiteral(resourceName: "beijing3@1.5x"))
        top_view1.isUserInteractionEnabled = true
        view.addSubview(top_view1)
        top_view1.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(UIDevice.lgf_NavBarH())
        }
        self.navTitle = "统计"
        self.lgf_NavigationBar.style.lgf_TitleColor = UIColor.white
        self.lgf_NavigationBar.lgf_Reload()
        
        scrollView = UIScrollView.lgf_Table("F6F7F9")
        if #available(iOS 11.0, *) {
            scrollView.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        view.addSubview(scrollView)
        scrollView.snp.makeConstraints { (make) in
            make.left.right.bottom.equalToSuperview()
            make.top.equalTo(top_view1.snp.bottom)
        }
        self.edgesForExtendedLayout = UIRectEdge.init()
        let top_view = UIImageView.init(image: #imageLiteral(resourceName: "beijing4@1.5x"))
        top_view.isUserInteractionEnabled = true
        top_view.translatesAutoresizingMaskIntoConstraints = false
        scrollView.addSubview(top_view)
        top_view.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.width.equalToSuperview()
            make.centerX.equalToSuperview()
            make.height.equalTo(210)
        }
        
        let view1 = UIView.init()
        view1.backgroundColor = UIColor.white
        view1.layer.cornerRadius = 4
        scrollView.addSubview(view1)
        view1.snp.makeConstraints { (make) in
            make.top.equalTo(top_view.snp.bottom).offset(-50)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(180)
        }
        
        mxys = UILabel.init()
        mxys.text = "明星医师"
        mxys.font = UIFont.boldSystemFont(ofSize: 15)
        mxys.textColor = UIColor.init(lgf_HexString: "222222")
        mxys.lgf_AddTap(target: self, action: #selector(TjVC.s_mxys(_:)))
        view1.addSubview(mxys)
        mxys.snp.makeConstraints { (make) in
            make.top.equalTo(15)
            make.centerX.equalToSuperview().multipliedBy(0.4)
            make.height.equalTo(30)
        }
        
        shzb = UILabel.init()
        shzb.text = "审核周榜"
        shzb.font = UIFont.systemFont(ofSize: 13)
        shzb.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        shzb.lgf_AddTap(target: self, action: #selector(TjVC.s_shzb(_:)))
        view1.addSubview(shzb)
        shzb.snp.makeConstraints { (make) in
            make.centerY.equalTo(mxys)
            make.centerX.equalToSuperview().multipliedBy(1.0)
            make.height.equalTo(30)
        }
        
        bzzb = UILabel.init()
        bzzb.text = "标注周榜"
        bzzb.font = UIFont.systemFont(ofSize: 13)
        bzzb.textColor = UIColor.init(lgf_HexString: "D2D2D5")
        bzzb.lgf_AddTap(target: self, action: #selector(TjVC.s_bzzb(_:)))
        view1.addSubview(bzzb)
        bzzb.snp.makeConstraints { (make) in
            make.centerY.equalTo(mxys)
            make.centerX.equalToSuperview().multipliedBy(1.6)
            make.height.equalTo(30)
        }
        
        // 第二
        let dier_i_b = UIView.init()
        dier_i_b.layer.cornerRadius = 28
        dier_i_b.clipsToBounds = true
        dier_i_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "E7E6E6"), endColor: UIColor.init(lgf_HexString: "D2D2D5"), frame: CGRect.init(x: 0, y: 0, width: 56, height: 56))
        view1.addSubview(dier_i_b)
        dier_i_b.snp.makeConstraints { (make) in
            make.top.equalTo(mxys.snp.bottom).offset(30)
            make.centerX.equalTo(mxys)
            make.width.height.equalTo(56)
        }
        dier_i = UIImageView.init(image: #imageLiteral(resourceName: "zhuanhuan@1.5x"))
        dier_i.layer.cornerRadius = 25
        view1.addSubview(dier_i)
        dier_i.snp.makeConstraints { (make) in
            make.center.equalTo(dier_i_b)
            make.width.height.equalTo(50)
        }
        let dier_i_l_b = UILabel.init()
        dier_i_l_b.layer.cornerRadius = 10
        dier_i_l_b.clipsToBounds = true
        dier_i_l_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "E7E6E6"), endColor: UIColor.init(lgf_HexString: "D2D2D5"), frame: CGRect.init(x: 0, y: 0, width: 56, height: 56))
        view1.addSubview(dier_i_l_b)
        dier_i_l_b.snp.makeConstraints { (make) in
            make.centerX.equalTo(dier_i)
            make.top.equalTo(dier_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        let dier_i_l = UILabel.init()
        dier_i_l.textAlignment = .center
        dier_i_l.layer.cornerRadius = 10
        dier_i_l.clipsToBounds = true
        dier_i_l.backgroundColor = UIColor.clear
        dier_i_l.font = UIFont.systemFont(ofSize: 12)
        dier_i_l.text = "2"
        dier_i_l.textColor = UIColor.white
        view1.addSubview(dier_i_l)
        dier_i_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(dier_i)
            make.top.equalTo(dier_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        
        // 第一
        let diyi_i_b_s = UIView.init()
        diyi_i_b_s.backgroundColor = UIColor.white
        diyi_i_b_s.layer.cornerRadius = 33
        diyi_i_b_s.layer.shadowColor = UIColor.init(lgf_HexString: "FFA600")?.cgColor
        diyi_i_b_s.layer.shadowRadius = 4
        diyi_i_b_s.layer.shadowOpacity = 0.4
        diyi_i_b_s.layer.shadowOffset = CGSize.init(width: 0, height: 3)
        view1.addSubview(diyi_i_b_s)
        diyi_i_b_s.snp.makeConstraints { (make) in
            make.bottom.equalTo(dier_i_b)
            make.centerX.equalTo(shzb)
            make.width.height.equalTo(66)
        }
        let diyi_i_b = UIView.init()
        diyi_i_b.layer.cornerRadius = 33
        diyi_i_b.clipsToBounds = true
        diyi_i_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "FFCA00"), endColor: UIColor.init(lgf_HexString: "FFA600"), frame: CGRect.init(x: 0, y: 0, width: 66, height: 66))
        view1.addSubview(diyi_i_b)
        diyi_i_b.snp.makeConstraints { (make) in
            make.bottom.equalTo(dier_i_b)
            make.centerX.equalTo(shzb)
            make.width.height.equalTo(66)
        }
        diyi_i = UIImageView.init(image: #imageLiteral(resourceName: "zhuanhuan@1.5x"))
        diyi_i.layer.cornerRadius = 30
        view1.addSubview(diyi_i)
        diyi_i.snp.makeConstraints { (make) in
            make.center.equalTo(diyi_i_b)
            make.width.height.equalTo(60)
        }
        let diyi_hg = UIImageView.init(image: #imageLiteral(resourceName: "huangguan@1.5x"))
        view1.addSubview(diyi_hg)
        diyi_hg.snp.makeConstraints { (make) in
            make.centerX.equalTo(diyi_i)
            make.bottom.equalTo(diyi_i.snp.top)
            make.width.equalTo(20)
            make.height.equalTo(17)
        }
        view1.bringSubviewToFront(diyi_i_b)
        view1.bringSubviewToFront(diyi_i)
        let diyi_i_l_b = UILabel.init()
        diyi_i_l_b.layer.cornerRadius = 10
        diyi_i_l_b.clipsToBounds = true
        diyi_i_l_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "FFCA00"), endColor: UIColor.init(lgf_HexString: "FFA600"), frame: CGRect.init(x: 0, y: 0, width: 56, height: 56))
        view1.addSubview(diyi_i_l_b)
        diyi_i_l_b.snp.makeConstraints { (make) in
            make.centerX.equalTo(diyi_i)
            make.top.equalTo(diyi_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        let diyi_i_l = UILabel.init()
        diyi_i_l.text = "1"
        diyi_i_l.textAlignment = .center
        diyi_i_l.layer.cornerRadius = 10
        diyi_i_l.clipsToBounds = true
        diyi_i_l.backgroundColor = UIColor.clear
        diyi_i_l.font = UIFont.systemFont(ofSize: 12)
        diyi_i_l.textColor = UIColor.white
        view1.addSubview(diyi_i_l)
        diyi_i_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(diyi_i)
            make.top.equalTo(diyi_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        
        // 第三
        let disan_i_b = UIView.init()
        disan_i_b.layer.cornerRadius = 28
        disan_i_b.clipsToBounds = true
        disan_i_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "F3D8C7"), endColor: UIColor.init(lgf_HexString: "D1AA9C"), frame: CGRect.init(x: 0, y: 0, width: 56, height: 56))
        view1.addSubview(disan_i_b)
        disan_i_b.snp.makeConstraints { (make) in
            make.bottom.equalTo(dier_i_b)
            make.centerX.equalTo(bzzb)
            make.width.height.equalTo(56)
        }
        disan_i = UIImageView.init(image: #imageLiteral(resourceName: "zhuanhuan@1.5x"))
        disan_i.layer.cornerRadius = 25
        view1.addSubview(disan_i)
        disan_i.snp.makeConstraints { (make) in
            make.center.equalTo(disan_i_b)
            make.width.height.equalTo(50)
        }
        let disan_i_l_b = UILabel.init()
        disan_i_l_b.layer.cornerRadius = 10
        disan_i_l_b.clipsToBounds = true
        disan_i_l_b.gradualBackgroundWithDirection(.vertical, startColor: UIColor.init(lgf_HexString: "F3D8C7"), endColor: UIColor.init(lgf_HexString: "D1AA9C"), frame: CGRect.init(x: 0, y: 0, width: 56, height: 56))
        view1.addSubview(disan_i_l_b)
        disan_i_l_b.snp.makeConstraints { (make) in
            make.centerX.equalTo(disan_i)
            make.top.equalTo(disan_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        let disan_i_l = UILabel.init()
        disan_i_l.textAlignment = .center
        disan_i_l.layer.cornerRadius = 10
        disan_i_l.clipsToBounds = true
        disan_i_l.backgroundColor = UIColor.clear
        disan_i_l.text = "3"
        disan_i_l.font = UIFont.systemFont(ofSize: 12)
        disan_i_l.textColor = UIColor.white
        view1.addSubview(disan_i_l)
        disan_i_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(disan_i)
            make.top.equalTo(disan_i_b.snp.bottom).offset(-10)
            make.width.height.equalTo(20)
        }
        
        
        dier_l = UILabel.init()
        dier_l.text = "等你放假"
        dier_l.font = UIFont.systemFont(ofSize: 12)
        dier_l.textColor = UIColor.init(lgf_HexString: "222222")
        view1.addSubview(dier_l)
        dier_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(dier_i)
            make.top.equalTo(dier_i.snp.bottom).offset(20)
        }
        
        diyi_l = UILabel.init()
        diyi_l.text = "等你放假"
        diyi_l.font = UIFont.systemFont(ofSize: 12)
        diyi_l.textColor = UIColor.init(lgf_HexString: "FFA700")
        view1.addSubview(diyi_l)
        diyi_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(diyi_i)
            make.centerY.equalTo(dier_l)
        }
        
        disan_l = UILabel.init()
        disan_l.text = "等你放假"
        disan_l.font = UIFont.systemFont(ofSize: 12)
        disan_l.textColor = UIColor.init(lgf_HexString: "222222")
        view1.addSubview(disan_l)
        disan_l.snp.makeConstraints { (make) in
            make.centerX.equalTo(disan_i)
            make.centerY.equalTo(dier_l)
        }
        
        tjjz = UILabel.init()
        tjjz.text = "听诊中心提供数据支持，统计截至2020.6.30"
        tjjz.font = UIFont.systemFont(ofSize: 12)
        tjjz.textColor = UIColor.init(lgf_HexString: "8D969D")
        scrollView.addSubview(tjjz)
        tjjz.snp.makeConstraints { (make) in
            make.top.equalTo(view1.snp.bottom).offset(10)
            make.left.equalTo(view1)
        }
        
        let sjsm = UILabel.init()
        sjsm.text = "数据说明"
        sjsm.font = UIFont.systemFont(ofSize: 12)
        sjsm.textColor = UIColor.init(lgf_HexString: "0F88F2")
        scrollView.addSubview(sjsm)
        sjsm.snp.makeConstraints { (make) in
            make.top.equalTo(view1.snp.bottom).offset(10)
            make.right.equalTo(view1)
        }
        
        let sjsm_i = UIImageView.init(image: #imageLiteral(resourceName: "shuoming@1.5x"))
        scrollView.addSubview(sjsm_i)
        sjsm_i.snp.makeConstraints { (make) in
            make.centerY.equalTo(sjsm)
            make.width.height.equalTo(12)
            make.right.equalTo(sjsm.snp.left).offset(-3)
        }
        
        let view2 = UIView.init()
        view2.backgroundColor = UIColor.white
        view2.layer.cornerRadius = 4
        scrollView.addSubview(view2)
        view2.snp.makeConstraints { (make) in
            make.top.equalTo(tjjz.snp.bottom).offset(25)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(165)
        }
        
        ybzs1 = ybzsV1.init()
        ybzs1.setData("样本总数", "124512", "20", true)
        view2.addSubview(ybzs1)
        ybzs1.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        ybzs2 = ybzsV1.init()
        ybzs2.setData("已筛查", "124512", "20", true)
        view2.addSubview(ybzs2)
        ybzs2.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalTo(ybzs1.snp.right)
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        ybzs3 = ybzsV1.init()
        ybzs3.setData("已标注", "124512", "20", true)
        view2.addSubview(ybzs3)
        ybzs3.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalTo(ybzs2.snp.right)
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        ybzs4 = ybzsV1.init()
        ybzs4.setData("样本总数", "11111", "20", true)
        view2.addSubview(ybzs4)
        ybzs4.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview()
            make.left.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        ybzs5 = ybzsV1.init()
        ybzs5.setData("已筛查", "124512", "20", false)
        view2.addSubview(ybzs5)
        ybzs5.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview()
            make.left.equalTo(ybzs4.snp.right)
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        ybzs6 = ybzsV1.init()
        ybzs6.setData("已标注", "4444", "20", true)
        view2.addSubview(ybzs6)
        ybzs6.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview()
            make.left.equalTo(ybzs5.snp.right)
            make.width.equalToSuperview().multipliedBy(0.33)
            make.height.equalToSuperview().multipliedBy(0.5)
        }
        
        let label1 = UILabel.init()
        label1.text = "本地"
        label1.font = UIFont.boldSystemFont(ofSize: 18)
        label1.textColor = UIColor.init(lgf_HexString: "222222")
        scrollView.addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.top.equalTo(view2.snp.bottom).offset(25)
            make.left.equalTo(view2)
        }
        
        dw = UILabel.init()
        dw.text = "杭州市"
        dw.font = UIFont.boldSystemFont(ofSize: 14)
        dw.textColor = UIColor.init(lgf_HexString: "0F88F2")
        scrollView.addSubview(dw)
        dw.snp.makeConstraints { (make) in
            make.right.equalTo(view2)
            make.centerY.equalTo(label1)
        }
        
        let dw_i = UIImageView.init(image: #imageLiteral(resourceName: "dingwei@1.5x"))
        scrollView.addSubview(dw_i)
        dw_i.snp.makeConstraints { (make) in
            make.centerY.equalTo(label1)
            make.right.equalTo(dw.snp.left).offset(-4)
            make.width.equalTo(10)
            make.height.equalTo(13)
        }
        
        let view3 = UIView.init()
        view3.backgroundColor = UIColor.white
        view3.layer.cornerRadius = 4
        scrollView.addSubview(view3)
        view3.snp.makeConstraints { (make) in
            make.top.equalTo(label1.snp.bottom).offset(15)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(150)
        }
        
        let label2 = UILabel.init()
        label2.text = "样本分布"
        label2.font = UIFont.boldSystemFont(ofSize: 18)
        label2.textColor = UIColor.init(lgf_HexString: "222222")
        scrollView.addSubview(label2)
        label2.snp.makeConstraints { (make) in
            make.top.equalTo(view3.snp.bottom).offset(25)
            make.left.equalTo(view2)
        }
        
        let view4 = UIView.init()
        view4.backgroundColor = UIColor.white
        view4.layer.cornerRadius = 4
        scrollView.addSubview(view4)
        view4.snp.makeConstraints { (make) in
            make.top.equalTo(label2.snp.bottom).offset(15)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(300)
        }
        
        china_map = ChinaV.init()
        view4.addSubview(china_map)
        china_map.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
        
        let label3 = UILabel.init()
        label3.text = "样本增长趁势"
        label3.font = UIFont.boldSystemFont(ofSize: 18)
        label3.textColor = UIColor.init(lgf_HexString: "222222")
        scrollView.addSubview(label3)
        label3.snp.makeConstraints { (make) in
            make.top.equalTo(view4.snp.bottom).offset(25)
            make.left.equalTo(view2)
        }
        
        let nyr_b = UIView.init()
        scrollView.addSubview(nyr_b)
        nyr_b.snp.makeConstraints { (make) in
            make.top.equalTo(label3.snp.bottom).offset(10)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(40)
        }
        let style = LGFSwiftPTStyle.init()
        style.lgf_Titles = ["年", "月", "日"]
        style.lgf_LineWidthType = .fixedWith
        style.lgf_TitleFixedWidth = (UIDevice.lgf_ScreenW - 34) / 3
        style.lgf_LineWidth = 40
        style.lgf_LineHeight = 2
        style.lgf_LineColor = UIColor.init(lgf_HexString: "0F88F2")
        style.lgf_PVTitleViewBackgroundColor = UIColor.clear
        style.lgf_TitleSelectFont = UIFont.boldSystemFont(ofSize: 15)
        style.lgf_UnTitleSelectFont = UIFont.boldSystemFont(ofSize: 15)
        style.lgf_TitleSelectColor = UIColor.init(lgf_HexString: "0F88F2")
        style.lgf_UnTitleSelectColor = UIColor.init(lgf_HexString: "CFD4D9")
        nyr = LGFSwiftPT.lgf(style, self, nyr_b, nil)
        nyr.lgf_SwiftPTDelegate = self
        nyr.lgf_ReloadTitle()
        
        let view5 = UIView.init()
        view5.backgroundColor = UIColor.white
        view5.layer.cornerRadius = 4
        scrollView.addSubview(view5)
        view5.snp.makeConstraints { (make) in
            make.top.equalTo(nyr_b.snp.bottom)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(315)
        }
        
        // 样本/有效样本
        let yb_yxyb = UIView.init()
        yb_yxyb.clipsToBounds = true
        yb_yxyb.layer.cornerRadius = 15
        view5.addSubview(yb_yxyb)
        yb_yxyb.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(30)
            make.top.equalTo(15)
            make.width.equalTo(125)
        }
        yb_l = UILabel.init()
        yb_l.text = "样本"
        yb_l.textAlignment = .center
        yb_l.textColor = UIColor.white
        yb_l.font = UIFont.systemFont(ofSize: 14)
        yb_l.backgroundColor = UIColor.init(lgf_HexString: "0F88F2")
        yb_l.lgf_AddTap(target: self, action: #selector(TjVC.s_yb(_:)))
        yb_yxyb.addSubview(yb_l)
        yb_l.snp.makeConstraints { (make) in
            make.top.bottom.left.equalToSuperview()
            make.width.equalTo(50)
        }
        yxyb_l = UILabel.init()
        yxyb_l.text = "有效样本"
        yxyb_l.textAlignment = .center
        yxyb_l.textColor = UIColor.white
        yxyb_l.font = UIFont.systemFont(ofSize: 14)
        yxyb_l.backgroundColor = UIColor.init(lgf_HexString: "E0E6EB")
        yxyb_l.lgf_AddTap(target: self, action: #selector(TjVC.s_yxyb(_:)))
        yb_yxyb.addSubview(yxyb_l)
        yxyb_l.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
            make.width.equalTo(75)
        }
        
        // 创建线状图组件对象
        ybzzcs_chart = LineChartView()
        ybzzcs_chart.noDataText = "暂无数据"
        ybzzcs_chart.setScaleEnabled(false)
        ybzzcs_chart.doubleTapToZoomEnabled = false
        ybzzcs_chart.legend.textColor = UIColor.purple
        ybzzcs_chart.legend.enabled = false
        ybzzcs_chart.leftAxis.axisMinimum = 0
        ybzzcs_chart.leftAxis.gridLineDashLengths = [4.0, 3.0]
        ybzzcs_chart.leftAxis.gridColor = UIColor.init(lgf_HexString: "CFD4D9")
        ybzzcs_chart.leftAxis.axisLineWidth = 0.0
        ybzzcs_chart.leftAxis.labelTextColor = UIColor.init(lgf_HexString: "8D969D")
        ybzzcs_chart.leftAxis.labelFont = UIFont.systemFont(ofSize: 12)
        ybzzcs_chart.leftAxis.granularity = 100
        ybzzcs_chart.rightAxis.axisMinimum = 0
        ybzzcs_chart.rightAxis.enabled = false
        ybzzcs_chart.xAxis.drawGridLinesEnabled = false
        ybzzcs_chart.xAxis.forceLabelsEnabled = true
        ybzzcs_chart.xAxis.granularityEnabled = true
        ybzzcs_chart.xAxis.axisLineWidth = 0.0
        ybzzcs_chart.xAxis.labelPosition = .bottom
        ybzzcs_chart.xAxis.yOffset = 16
        ybzzcs_chart.xAxis.labelTextColor = UIColor.init(lgf_HexString: "8D969D")
        ybzzcs_chart.xAxis.labelFont = .systemFont(ofSize: 12)
        ybzzcs_chart.xAxis.axisMinimum = -0.25
        ybzzcs_chart.xAxis.axisMaximum = 6.25
        view5.addSubview(ybzzcs_chart)
        ybzzcs_chart.snp.makeConstraints { (make) in
            make.width.equalToSuperview().offset(-24)
            make.centerX.equalToSuperview()
            make.top.equalTo(yb_yxyb.snp.bottom)
            make.height.equalTo(215)
        }
        
        yy1 = UILabel.init()
        yy1.text = ""
        yy1.font = UIFont.systemFont(ofSize: 12)
        yy1.textColor = UIColor.init(lgf_HexString: "8D969D")
        view5.addSubview(yy1)
        yy1.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview().multipliedBy(0.4)
            make.bottom.equalTo(-15)
        }
        yy1_v = UIView.init()
        yy1_v.layer.cornerRadius = 4
        view5.addSubview(yy1_v)
        yy1_v.snp.makeConstraints { (make) in
            make.right.equalTo(yy1.snp.left).offset(-5)
            make.centerY.equalTo(yy1)
            make.width.height.equalTo(8)
        }
        
        yy2 = UILabel.init()
        yy2.text = ""
        yy2.font = UIFont.systemFont(ofSize: 12)
        yy2.textColor = UIColor.init(lgf_HexString: "8D969D")
        view5.addSubview(yy2)
        yy2.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview().multipliedBy(1.0)
            make.bottom.equalTo(-15)
        }
        yy2_v = UIView.init()
        yy2_v.layer.cornerRadius = 4
        view5.addSubview(yy2_v)
        yy2_v.snp.makeConstraints { (make) in
            make.right.equalTo(yy2.snp.left).offset(-5)
            make.centerY.equalTo(yy2)
            make.width.height.equalTo(8)
        }
        
        yy3 = UILabel.init()
        yy3.text = ""
        yy3.font = UIFont.systemFont(ofSize: 12)
        yy3.textColor = UIColor.init(lgf_HexString: "8D969D")
        view5.addSubview(yy3)
        yy3.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview().multipliedBy(1.6)
            make.bottom.equalTo(-15)
        }
        yy3_v = UIView.init()
        yy3_v.layer.cornerRadius = 4
        view5.addSubview(yy3_v)
        yy3_v.snp.makeConstraints { (make) in
            make.right.equalTo(yy3.snp.left).offset(-5)
            make.centerY.equalTo(yy3)
            make.width.height.equalTo(8)
        }
        
        let label4 = UILabel.init()
        label4.text = "医生标注TOP"
        label4.font = UIFont.boldSystemFont(ofSize: 18)
        label4.textColor = UIColor.init(lgf_HexString: "222222")
        scrollView.addSubview(label4)
        label4.snp.makeConstraints { (make) in
            make.top.equalTo(view5.snp.bottom).offset(25)
            make.left.equalTo(view2)
        }
        
        let view6 = UIView.init()
        view6.backgroundColor = UIColor.white
        view6.layer.cornerRadius = 4
        scrollView.addSubview(view6)
        view6.snp.makeConstraints { (make) in
            make.top.equalTo(label4.snp.bottom).offset(15)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(400)
        }
        
        let ysbz_h1 = ysbzV_h.init()
        view6.addSubview(ysbz_h1)
        ysbz_h1.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(45)
        }
        ysbz_h1.setData("排名", "姓名", "标注总数", "死亡率", "治愈率")
        
        for i in 0..<10 {
            let ysbz1 = ysbzV.init()
            view6.addSubview(ysbz1)
            ysbz1.snp.makeConstraints { (make) in
                make.left.right.equalToSuperview()
                make.top.equalTo(ysbz_h1.snp.bottom).offset(i * 35)
                make.height.equalTo(35)
            }
            ysbz1.setData((i + 1).description, "来国锋", "100", "100%", "20%")
        }
        
        let label5 = UILabel.init()
        label5.text = "病种"
        label5.font = UIFont.boldSystemFont(ofSize: 18)
        label5.textColor = UIColor.init(lgf_HexString: "222222")
        scrollView.addSubview(label5)
        label5.snp.makeConstraints { (make) in
            make.top.equalTo(view6.snp.bottom).offset(25)
            make.left.equalTo(view2)
        }
        
        let view7 = UIView.init()
        view7.backgroundColor = UIColor.white
        view7.layer.cornerRadius = 4
        scrollView.addSubview(view7)
        view7.snp.makeConstraints { (make) in
            make.top.equalTo(label5.snp.bottom).offset(15)
            make.width.equalToSuperview().offset(-34)
            make.centerX.equalToSuperview()
            make.height.equalTo(400)
        }
        
        let ysbz_h2 = ysbzV_h.init()
        view7.addSubview(ysbz_h2)
        ysbz_h2.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(45)
        }
        ysbz_h2.setData("排名", "姓名", "标注总数", "死亡率", "治愈率")
        
        for i in 0..<10 {
            let ysbz1 = ysbzV.init()
            view7.addSubview(ysbz1)
            ysbz1.snp.makeConstraints { (make) in
                make.left.right.equalToSuperview()
                make.top.equalTo(ysbz_h2.snp.bottom).offset(i * 35)
                make.height.equalTo(35)
            }
            ysbz1.setData((i + 1).description, "来国锋", "100", "100%", "20%")
        }
        
        scrollView.lgf_AutoContentSize(40)
        
    }
    
}

extension TjVC {
    func setLineData(_ list1: [[String: Any]], _ list2: [[String: Any]], _ list3: [[String: Any]], _ xValues: [String], _ line: LineChartView!) {
        if line == nil {
            return
        }
        line.xAxis.valueFormatter = IndexAxisValueFormatter(values: xValues)
        line.xAxis.labelCount = 7
        line.data = LineChartData(dataSets: [getChartDataSet(list1, yy_color[0]), getChartDataSet(list2, yy_color[1]), getChartDataSet(list3, yy_color[2])])
    }
    
    func getChartDataSet(_ list: [[String: Any]], _ color: String) -> LineChartDataSet {
        var dataEntries = [ChartDataEntry]()
        for (index, value) in list.enumerated() {
            let y = value["num"]
            let entry = ChartDataEntry.init(x: Double(index), y: Double(y as! Int))
            dataEntries.append(entry)
        }
        let chartDataSet = LineChartDataSet(entries: dataEntries, label: "")
        chartDataSet.mode = .horizontalBezier
        chartDataSet.drawFilledEnabled = true
        let gradientColors = [UIColor.init(lgf_HexString: color).cgColor, UIColor.white.cgColor] as CFArray
        let colorLocations:[CGFloat] = [1.0, 0.0]
        let gradient = CGGradient.init(colorsSpace: CGColorSpaceCreateDeviceRGB(),
                                       colors: gradientColors, locations: colorLocations)
        chartDataSet.fill = Fill.fillWithLinearGradient(gradient!, angle: 90.0)
        chartDataSet.colors = [UIColor.init(lgf_HexString: color)]
        chartDataSet.circleColors = [UIColor.clear]
        chartDataSet.circleHoleColor = UIColor.clear
        chartDataSet.circleRadius = 0
        chartDataSet.circleHoleRadius = 0
        chartDataSet.lineWidth = 2
        chartDataSet.drawVerticalHighlightIndicatorEnabled = false
        chartDataSet.drawHorizontalHighlightIndicatorEnabled = false
        chartDataSet.highlightEnabled = false
        chartDataSet.drawValuesEnabled = false
        
        return chartDataSet
    }
}

extension TjVC: LGFSwiftPTDelegate {
    func lgf_SelectSwiftPTTitle(_ selectIndex: Int) {
        if selectIndex == 0 {
            
        } else if selectIndex == 1 {
            
        } else if selectIndex == 2 {
            
        }
    }
}

class ybzsV1: UIView {
    
    var label1: UILabel!
    var label2: UILabel!
    var label3: UILabel!
    var label3_b: UIView!
    var label3_i: UIImageView!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        label1 = UILabel.init()
        label1.font = UIFont.boldSystemFont(ofSize: 12)
        label1.textColor = UIColor.init(lgf_HexString: "8D969D")
        addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalToSuperview().offset(10)
        }
        
        label2 = UILabel.init()
        label2.font = UIFont.boldSystemFont(ofSize: 20)
        label2.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label2)
        label2.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(label1.snp.bottom).offset(5)
        }
        
        let label4 = UILabel.init()
        label4.text = "较昨日"
        label4.font = UIFont.boldSystemFont(ofSize: 12)
        label4.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        addSubview(label4)
        label4.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview().offset(-15)
            make.top.equalTo(label2.snp.bottom).offset(5)
        }
        
        label3_b = UIView.init()
        label3_b.layer.cornerRadius = 6
        label3_b.backgroundColor = UIColor.init(lgf_HexString: "EBFAFD ")
        addSubview(label3_b)
        label3_b.snp.makeConstraints { (make) in
            make.centerY.equalTo(label4)
            make.left.equalTo(label4.snp.right).offset(3)
            make.height.equalTo(12)
        }
        
        label3 = UILabel.init()
        label3.font = UIFont.boldSystemFont(ofSize: 10)
        label3.textColor = UIColor.init(lgf_HexString: "00C9F4")
        label3_b.addSubview(label3)
        label3.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(3)
            make.centerY.equalToSuperview()
        }
        
        label3_i = UIImageView.init(image: #imageLiteral(resourceName: "shang@1.5x"))
        label3_b.addSubview(label3_i)
        label3_i.snp.makeConstraints { (make) in
            make.left.equalTo(label3.snp.right).offset(3)
            make.right.equalToSuperview().offset(-3)
            make.centerY.equalTo(label3)
            make.width.height.equalTo(5)
        }
        
    }
    
    func setData(_ data1: String, _ data2: String, _ data3: String, _ isUp: Bool) {
        label1.text = data1
        label2.text = data2
        label3.text = data3
        if isUp {
            label3.textColor = UIColor.init(lgf_HexString: "00C9F4")
            label3_b.backgroundColor = UIColor.init(lgf_HexString: "EBFAFD")
            label3_i.image = #imageLiteral(resourceName: "shang@1.5x")
        } else {
            label3.textColor = UIColor.init(lgf_HexString: "FFA600")
            label3_b.backgroundColor = UIColor.init(lgf_HexString: "FFF8E9")
            label3_i.image = #imageLiteral(resourceName: "xia@1.5x")
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

class ybzsV2: UIView {
    
    var label1: UILabel!
    var label2: UILabel!
    var label3: UILabel!
    var label3_b: UIView!
    var label3_i: UIImageView!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
    }
    
    func setData(_ data1: String, _ data2: String, _ data3: String, _ isUp: Bool) {
        label1.text = data1
        label2.text = data2
        label3.text = data3
        if isUp {
            label3.textColor = UIColor.init(lgf_HexString: "00C9F4")
            label3_b.backgroundColor = UIColor.init(lgf_HexString: "EBFAFD")
            label3_i.image = #imageLiteral(resourceName: "shang@1.5x")
        } else {
            label3.textColor = UIColor.init(lgf_HexString: "FFA600")
            label3_b.backgroundColor = UIColor.init(lgf_HexString: "FFF8E9")
            label3_i.image = #imageLiteral(resourceName: "xia@1.5x")
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

class ysbzV: UIView {
    
    var label1: UILabel!
    var image1: UIImageView!
    var label2: UILabel!
    var label3: UILabel!
    var label4: UILabel!
    var label5: UILabel!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        label1 = UILabel.init()
        label1.textAlignment = .center
        label1.font = UIFont.boldSystemFont(ofSize: 12)
        label1.textColor = UIColor.init(lgf_HexString: "8D969D")
        addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.top.bottom.left.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        image1 = UIImageView.init(image: #imageLiteral(resourceName: "bang1@1.5x"))
        image1.isHidden = true
        addSubview(image1)
        image1.snp.makeConstraints { (make) in
            make.center.equalTo(label1)
            make.width.height.equalTo(18)
        }
        
        label2 = UILabel.init()
        label2.textAlignment = .center
        label2.font = UIFont.boldSystemFont(ofSize: 12)
        label2.textColor = UIColor.init(lgf_HexString: "8D969D")
        addSubview(label2)
        label2.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label1.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label3 = UILabel.init()
        label3.textAlignment = .center
        label3.font = UIFont.boldSystemFont(ofSize: 12)
        label3.textColor = UIColor.init(lgf_HexString: "8D969D")
        addSubview(label3)
        label3.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label2.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label4 = UILabel.init()
        label4.textAlignment = .center
        label4.font = UIFont.boldSystemFont(ofSize: 12)
        label4.textColor = UIColor.init(lgf_HexString: "0F88F2")
        addSubview(label4)
        label4.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label3.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label5 = UILabel.init()
        label5.textAlignment = .center
        label5.font = UIFont.boldSystemFont(ofSize: 12)
        label5.textColor = UIColor.init(lgf_HexString: "00C9F4")
        addSubview(label5)
        label5.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label4.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
    }
    
    func setData(_ data1: String, _ data2: String, _ data3: String, _ data4: String, _ data5: String) {
        label1.text = data1
        label2.text = data2
        label3.text = data3
        label4.text = data4
        label5.text = data5
        if (Int(data1) ?? 0) < 4 {
            image1.isHidden = false
            if (Int(data1) ?? 0) == 1 {
                image1.image = #imageLiteral(resourceName: "bang1@1.5x")
            } else if (Int(data1) ?? 0) == 2 {
                image1.image = #imageLiteral(resourceName: "bang2@1.5x")
            } else if (Int(data1) ?? 0) == 3 {
                image1.image = #imageLiteral(resourceName: "bang3@1.5x")
            }
        } else {
            image1.isHidden = true
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

class ysbzV_h: UIView {
    
    var label1: UILabel!
    var label2: UILabel!
    var label3: UILabel!
    var label4: UILabel!
    var label5: UILabel!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        label1 = UILabel.init()
        label1.textAlignment = .center
        label1.font = UIFont.boldSystemFont(ofSize: 14)
        label1.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.top.bottom.left.equalToSuperview()
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label2 = UILabel.init()
        label2.textAlignment = .center
        label2.font = UIFont.boldSystemFont(ofSize: 14)
        label2.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label2)
        label2.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label1.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label3 = UILabel.init()
        label3.textAlignment = .center
        label3.font = UIFont.boldSystemFont(ofSize: 14)
        label3.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label3)
        label3.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label2.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label4 = UILabel.init()
        label4.textAlignment = .center
        label4.font = UIFont.boldSystemFont(ofSize: 14)
        label4.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label4)
        label4.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label3.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
        
        label5 = UILabel.init()
        label5.textAlignment = .center
        label5.font = UIFont.boldSystemFont(ofSize: 14)
        label5.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(label5)
        label5.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(label4.snp.right)
            make.width.equalToSuperview().multipliedBy(0.2)
        }
    }
    
    func setData(_ data1: String, _ data2: String, _ data3: String, _ data4: String, _ data5: String) {
        label1.text = data1
        label2.text = data2
        label3.text = data3
        label4.text = data4
        label5.text = data5
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension TjVC {
    func o_mxys() {
        mxys.font = UIFont.boldSystemFont(ofSize: 15)
        mxys.textColor = UIColor.init(lgf_HexString: "222222")
        shzb.font = UIFont.systemFont(ofSize: 13)
        shzb.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        bzzb.font = UIFont.systemFont(ofSize: 13)
        bzzb.textColor = UIColor.init(lgf_HexString: "CFD4D9")
    }
    
    func o_shzb() {
        mxys.font = UIFont.boldSystemFont(ofSize: 13)
        mxys.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        shzb.font = UIFont.systemFont(ofSize: 15)
        shzb.textColor = UIColor.init(lgf_HexString: "222222")
        bzzb.font = UIFont.systemFont(ofSize: 13)
        bzzb.textColor = UIColor.init(lgf_HexString: "CFD4D9")
    }
    
    func o_bzzb() {
        mxys.font = UIFont.boldSystemFont(ofSize: 13)
        mxys.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        shzb.font = UIFont.systemFont(ofSize: 13)
        shzb.textColor = UIColor.init(lgf_HexString: "CFD4D9")
        bzzb.font = UIFont.systemFont(ofSize: 15)
        bzzb.textColor = UIColor.init(lgf_HexString: "222222")
    }
}
